package com.hzw.saas.api.group.enums;

import java.util.Objects;

/**
 * <p>
 *
 * </p>
 *
 * @author sonam
 * @since 2021/3/6 21:48
 */
public enum GroupMemberStatus {
    NORMAL(0, "已发送申请"), NO_EXIST(1, "没有申请"), INVALID(-1, "申请过期");

    GroupMemberStatus(Integer value, String text) {
        this.value = value;
        this.text = text;
    }

    private final Integer value;
    private final String text;
    public Integer value() {
        return this.value;
    }
    public String text() {
        return this.text;
    }

    public static String text(Integer value) {
        for (GroupMemberStatus groupMemberStatus : GroupMemberStatus.values()) {
            if (Objects.equals(groupMemberStatus.value, value)) {
                return groupMemberStatus.text;
            }
        }
        return null;
    }

    public static GroupMemberStatus instance(Integer value) {
        for (GroupMemberStatus groupMemberStatus : GroupMemberStatus.values()) {
            if (Objects.equals(groupMemberStatus.value, value)) {
                return groupMemberStatus;
            }
        }
        return null;
    }
}
